package com.ustcinfo.study.hbase.xngroup.mouyiquan;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.DriverManager;

/**
 * @Author: Yiquan Mou
 * @Email: ctbumyq@gmail.com
 * @Description:
 * @Date: Created in 19:04 2018/8/1
 */
public class JdbcUtils {
    private static  Connection con = null;

    public static Connection GetConnection(){
        //创建一个JdbcTool 工具类 用于专门得到数据库链接
        try {
            //加载mysql驱动
            Class.forName("com.mysql.jdbc.Driver");
            //获取数据库链接对象
            con =  (Connection)   DriverManager.getConnection("jdbc:mysql://localhost:3306/test","root","123456");
        } catch (ClassNotFoundException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (SQLException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

        return con;
    }

}
